package com.sushi.controller;

import com.sushi.pojo.User;
import org.springframework.web.bind.annotation.*;

@RestController()
//@Controller
//@ResponseBody
@RequestMapping("/user")
public class Controller10 {

//    @RequestMapping(value = "/findAll", method = RequestMethod.GET)
//    @ResponseBody
    @GetMapping
    public String findAll() {
        System.out.println("查所有");
        return "SELECT SUCCESSFUL!";
    }
//    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
//    @ResponseBody
    @GetMapping("/{id}")
    public String findById(@PathVariable int id) {
        System.out.println("按ID查");
        return "SELECT BY ID SUCCESSFUL!";
    }
//    @RequestMapping(value = "/", method = RequestMethod.POST)
//    @ResponseBody
    @PostMapping
    public String add(@RequestBody User user) {
        System.out.println("加个元素：" + user);
        return "ADD SUCCESSFUL!";
    }
//    @RequestMapping(value = "/", method = RequestMethod.PUT)
//    @ResponseBody
    @PutMapping
    public String change(@RequestBody User user) {
        System.out.println("更改：" + user);
        return "CHANGE SUCCESSFUL!";
    }
//    @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
//    @ResponseBody
    @DeleteMapping("/{id}")
    public String delete(@PathVariable int id) {
        System.out.println("删除id：" + id);
        return "DELETE SUCCESSFUL!";
    }

}
